/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Scanner;

/**
 * <p>Project: jse2306 - Ex2</p>
 * <p>Powered by webrx On 2023-10-10 11:41:15</p>
 * <p>description: </p>
 *
 * @author 李四 [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex2 {
    public static void main(String[] args) {
        //实例化对象 Scanner类可以键盘输入数据
        Scanner s = new Scanner(System.in);
        System.out.println("请输入：两个数字");
        int a = s.nextInt();
        int b = s.nextInt();
        if (b == 0) {
            //println() 输出并换行 printf() 格式化输出，%d点位符
            System.out.printf("%d ÷ %d 是错误的，因为不能除0", a, b);
        } else if (a % b == 0) {//如果余数为0，就可以整除
            System.out.printf("%d ÷ %d = %d%n", a, b, a / b);
        } else {
            System.out.printf("%d ÷ %d = %d ... %d%n", a, b, a / b, a % b);
        }
    }
}
